import { config } from 'utils'
import dvarequest from '../utils/dvarequest'

const { api } = config
const { systemprocess } = api

export function fetch ({ page }) {
  return dvarequest(systemprocess, {
    method: 'POST',
    body: JSON.stringify({ page }),
  })
}
export function list () {
  return dvarequest(`${systemprocess}/list`, {
    method: 'POST',
  })
}
export function systemprocessNameList () {
  return dvarequest(`${systemprocess}/list`, {
    method: 'POST',
  })
}
export function remove (id) {
  return dvarequest(`${systemprocess}/${id}`, {
    method: 'DELETE',
  })
}

export function patch (payload) {
  return dvarequest(`${systemprocess}/${payload.id}`, {
    method: 'PUT',
    body: JSON.stringify(payload.values),
  })
}

export function create (values) {
  return dvarequest(`${systemprocess}/add`, {
    method: 'POST',
    body: JSON.stringify(values),
  })
}
